package ua.epam.muzalevskiy.traction.dao;

import java.sql.Connection;
import java.sql.SQLException;


/**
 * This interface describe methods we needed to create and destroy DataBase
 * <code> Connection </code>.
 *
 * @author Muzalevskiy Vitaliy
 */
public interface ConnectionFactory {
    
    /**
     * Create new <code> Connection </code> to DataBase.
     *
     * @return new <code> Connection </code>.
     * @throws SQLException
     */
    Connection newConnection() throws SQLException;
    
    /**
     * This method need to be override if we use Connection Pool. If we don't,
     * it can just throw UnsupportedOperationException.
     *
     * @throws SQLException
     */
    void close() throws SQLException;
}
